<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="container">
      <input class="ipt" type="text" />
      <button class="throttle-btn">验证节流</button>
    </div>
  </body>
  <script src="./防抖/debounce.js"></script>
  <script src="./节流/throttle.js"></script>
  <script>
    const ipt = document.querySelector('.ipt')
    const throttleBtn = document.querySelector('.throttle-btn')
    ipt.addEventListener(
      'keyup',
      debounce(e => {
        console.log(e.target.value)
      })
    )
    throttleBtn.addEventListener(
      'click',
      throttle(() => {
        console.log('点击了')
      })
    )
  </script>
</html>
